#ifndef UDEF_H
#define UDEF_H

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <err.h>
#include <assert.h>
#include <string.h>
#include <inttypes.h>

#include <sys/param.h>
#include <ufs/ffs/fs.h>
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>

#include <sys/time.h>
//#include <sys/types.h>



#define	MEASURE	1
#define	DEBUG	0


/*
 * Padding delam kvuli tomu, ze hnedka za hlavickou se nachazeji 
 * napr. nektere bitmapy.
 */
typedef union {
    struct fs fs; 
    char pad[MAXBSIZE];
} fsun;

fsun aafs;
#define afs aafs.fs

 
typedef union {
    struct cg cg; 
    char pad[MAXBSIZE];
} cgun;


#define		NINDIRS		(afs.fs_bsize/sizeof(int32_t))

typedef struct {
	int 	fd;					/* fd */
	void	**blockap;			/* block map */
	
	/* pole ukazujici na blockap polozky reprezentujici serazene bloky */
	void 	**slink;		
	int		slink_size;		
	
	/* ukazatel na cg pomoci mmap */
	void 	*memcg;
	
	struct cg *acg;			/* current cylinder */
	
	uint32_t 	flags;
} GLBVAL;


#define		GLBCGISMMAP		0x00000001
#define		GLBRUNINSEC		0x00000002	/* hop sort mode */


void usage(void);




#endif
